<?php
session_start();
if(isset($_SESSION['admin_id'])) {
    include "../../include/dbFunctions.php";
    $id = $_SESSION['vid'];
    $email = htmlspecialchars($_POST['email']);
    $password = SHA1($_POST['password']);
    $status = ($_POST['status']);
    if ($password==SHA1('__________')) {
        $query1 = "UPDATE volunteer
            SET volunteer_email = '".$email."',
                volunteer_status = '".$status."'
            WHERE volunteer_id=$id";
    } else {
        $query1 = "UPDATE volunteer
            SET volunteer_email = '".$email."',
                volunteer_password = '".$password."',
                volunteer_status = '".$status."'
            WHERE volunteer_id=$id";
    }
//update volunteer table
    $result1 = executeQuery($query1);
    $link = "../volunteerView.php?id=$id";
    if (($result1!=0)) {
        $_SESSION['mes']="The record has been updated successfully";
    } else {
        $_SESSION['mes']="Error! Please try again";
    }
    header("Location: $link");
    /*
 * echo $id."<br/>";
echo $salutation."<br/>";
echo $name."<br/>";
echo $gender."<br/>";
echo $email."<br/>";
echo $office."<br/>";
echo $mobile."<br/>";
echo $address."<br/>";
echo $sponsor."<br/>";
print_r($education);
echo"<br/>";
echo $day_p."<br/>";
    */
    ?>
    <?php
}else {
    header("Location: ../include/login.html");
}
?>